#include "aircraft.h"
#include <iostream>
Aircraft::Aircraft(Type type, const TextureManager& textures)
	: mType(type), mSprite(textures.get(toTextureID(type)))
{
	auto bound = mSprite.getLocalBounds();
	mSprite.setOrigin(bound.width / 2.f, bound.height / 2.f);
}

TextureID Aircraft::toTextureID(Type type)
{
	TextureID res;
	switch (type)
	{
	case Aircraft::Type::Eager:
		res = TextureID::Eager;
		break;
	case Aircraft::Type::Raper:
		res = TextureID::Raper;
		break;
	default:
		assert(false);
		break;
	}
	return res;
}

void Aircraft::accelerate(sf::Vector2f velocity)
{
	setVelocity(getVelocity() + velocity);
}

void Aircraft::drawCurrent(sf::RenderTarget & target, sf::RenderStates states) const
{
	target.draw(mSprite, states);
}